package com.kagura.querydrug.dao;

import com.kagura.querydrug.pojo.DrugYpkc;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @PACKAGE_NAME: com.kagura.querydrug.dao
 * @CLASS_NAME: DrugYpkcDao
 * @USER: kagura
 * @Description TODO
 * @Date 2021/6/3 5:52 下午
 * @MONTH_NAME_FULL: 六月
 * @DAY: 03
 * @DAY_NAME_FULL: 星期四
 * @PROJECT_NAME: queryDrug
 **/
@Mapper
public interface DrugYpkcDao {

    /**
     * 根据药品名称查询药品具体信息
     */
    // 结果集映射
    @Results({
            @Result(column = "YAOPINID", property = "yaoPinId"),
            @Result(column = "storage_code", property = "storageCode"),
            @Result(column = "storage_name", property = "storageName"),
            @Result(column = "ypbm", property = "ypbm"),
            @Result(column = "ypmc", property = "ypmc"),
            @Result(column = "jbgg", property = "jbgg"),
            @Result(column = "jbdw", property = "jbdw"),
            @Result(column = "pc", property = "pc"),
            @Result(column = "ph", property = "ph"),
            @Result(column = "xq", property = "xq"),
            @Result(column = "sccs", property = "sccs"),
            @Result(column = "package_spec", property = "packageSpec"),
            @Result(column = "package_units", property = "packageUnits"),
            @Result(column = "pfj", property = "pfj"),
            @Result(column = "lsj", property = "lsj"),
            @Result(column = "gybz", property = "gybz"),
            @Result(column = "gpkc", property = "gpkc"),
            @Result(column = "update_date", property = "updateDate")
    })
    @Select("select * from jhip_dict_ypkc t where t.ypmc = #{ypmc}")
    List<DrugYpkc> findByYPMC(@Param("ypmc") String ypmc);

    /**
     * 根据发药科室查询该科室的药品信息
     */
    // 结果集映射
    @Results({
            @Result(column = "YAOPINID", property = "yaoPinId"),
            @Result(column = "storage_code", property = "storageCode"),
            @Result(column = "storage_name", property = "storageName"),
            @Result(column = "ypbm", property = "ypbm"),
            @Result(column = "ypmc", property = "ypmc"),
            @Result(column = "jbgg", property = "jbgg"),
            @Result(column = "jbdw", property = "jbdw"),
            @Result(column = "pc", property = "pc"),
            @Result(column = "ph", property = "ph"),
            @Result(column = "xq", property = "xq"),
            @Result(column = "sccs", property = "sccs"),
            @Result(column = "package_spec", property = "packageSpec"),
            @Result(column = "package_units", property = "packageUnits"),
            @Result(column = "pfj", property = "pfj"),
            @Result(column = "lsj", property = "lsj"),
            @Result(column = "gybz", property = "gybz"),
            @Result(column = "gpkc", property = "gpkc"),
            @Result(column = "update_date", property = "updateDate")
    })
    @Select("select * from jhip_dict_ypkc t where t.storage_name = #{storageName}")
    List<DrugYpkc> findByStorageName(@Param("storageName") String storageName);
}
